from collections.abc import Sized
import abc

class Company:
    def __init__(self,employees):
        self.employees = employees

    def __len__(self):
        return len(self.employees)

company = Company(["jack","rose","jonh"])
print(hasattr(company, "__len__"))    #True
print(isinstance(company, Sized))     #True


class Cache(metaclass=abc.ABCMeta):
    @abc.abstractmethod
    def get(self,k):
        pass
    @abc.abstractmethod
    def set(self,k,v):
        pass

class RedisCache(Cache):
    pass


redis = RedisCache()   # 这一不就会异常
redis.set('a','afdf')